package com.jike.noobmoney.adapter;


import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.jike.noobmoney.R;
import com.jike.noobmoney.entity.ShenHeEntity;
import com.jike.noobmoney.util.ComUtils;


/**
 * Created by kekex on 2018/9/8.
 * 审核
 */

public class ShenHeAdapter extends BaseRecyclerAdapter<ShenHeEntity.OrderlistBean> {


    private Context context;

    public ShenHeAdapter(Context context) {
        super(R.layout.item_shen_he_list);
        this.context = context;

    }

    @Override
    protected void onBindViewHolder(SmartViewHolder holder, ShenHeEntity.OrderlistBean item, int position) {
        //审核列表 订单编号
        holder.text(R.id.tv_order_number, item.getU_id()+"");

        //订单金额
        holder.text(R.id.tv_total_money, "" + item.getMoney());

        //订单人用户
        holder.text(R.id.tv_user, "用户:" + ComUtils.jiequPhone(item.getMobile()));

        TextView tvTime = (TextView) holder.findViewById(R.id.tv_time);
        TextView tv_shens_reason=(TextView)holder.findViewById(R.id.tv_shens_reason);
        TextView tv_is_tousued=(TextView)holder.findViewById(R.id.tv_is_tousued);
        if(item.istaskappeal.equals("1")){
            tv_is_tousued.setVisibility(View.VISIBLE);
            tv_is_tousued.setText("该单投诉中，等待官方处理");
        }else
        {
            tv_is_tousued.setVisibility(View.GONE);
        }

        int status = item.getStatus();
        if (status == 3) {
            tvTime.setVisibility(View.VISIBLE);
            tvTime.setText("限定时间："+item.passtime + "未审核将自动通过");
            tv_shens_reason.setVisibility(View.GONE);
        } else if (status == 2) {
            tvTime.setVisibility(View.VISIBLE);
            tvTime.setText("失败时间："+item.badtime +" 审核失败未通过");
            tv_shens_reason.setVisibility(View.GONE);
        } else if (status == 1) {
            tvTime.setVisibility(View.VISIBLE);
            tvTime.setText("限定时间:+"+item.canceltime+"未提交将自动取消");
            tv_shens_reason.setVisibility(View.GONE);
        } else if (status == 4) {
            tvTime.setVisibility(View.VISIBLE);
            tvTime.setText("完成时间："+item.getFinishtime()+" 审核通过已完成");
            tv_shens_reason.setVisibility(View.GONE);
        }else if(status == 5)
        {
            tvTime.setVisibility(View.VISIBLE);
            tvTime.setText(" 已被投诉，请耐心等待处理结果");
            tv_shens_reason.setVisibility(View.VISIBLE);
            tv_shens_reason.setText("投诉原因："+item.getAtext());

        }else {
            tvTime.setVisibility(View.GONE);
        }

        switch (status) {
            case 1:
                holder.text(R.id.tv_status, "待完成");
                break;
            case 3:
                holder.text(R.id.tv_status, "待审核");
                break;
            case 4:
                holder.text(R.id.tv_status, "已通过");
                break;
            case 2:
                holder.text(R.id.tv_status, "未通过");
                break;
        }


    }

}
